package com.imooc.order.server.controller;





import com.imooc.product.client.ProductClient;
import com.imooc.product.common.DecreaseStockInput;
import com.imooc.product.common.ProductInfoOutput;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;


/**
 * @Author: wangjunjie 22:36$ 2018/5/26$
 * @Description:$params$
 * @Version: 1.0.0
 * @Modified By: xxx 22:36$ 2018/5/26$
 */
@RestController
@Slf4j

public class ClientController {

    @Autowired
    private ProductClient productClient;


    @GetMapping("/getProductList")
    public String getProductList() {
        List<ProductInfoOutput> response = productClient.listForOrder(Arrays.asList("12"));
        log.info("response={}",response);
        return "ok";
    }

    @GetMapping("/productDecreaseStock")
    public String productDecreaseStock() {
        productClient.decreaseStock(Arrays.asList(new DecreaseStockInput("12",1)));
        return "ok";
    }

}
